package com.wbu.mapper;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import com.wbu.entity.Admin;
import com.wbu.entity.Park;
@Mapper
public interface ParkMapper {
	
	@Select("select * from park ")
	public List<Park> findAllPark(); 
	
	@Select("select * from park where status = #{status}")
	public List<Park> findAllParkByStatus(@Param("status")int status); 
	
	@Select("select * from park where name like concat(concat(\"%\",#{key}),\"%\") ")
	public List<Park> findAllParkByKey(@Param("key")String key);
	
	@Select("select * from park where id= #{id} ")
	public Park findParkById(@Param("id")int id);
	
	@Insert("insert into park(name,price,status) values(#{name},#{price},#{status})")
	@SelectKey(keyColumn="id",keyProperty="id",resultType=Integer.class,before=false,statement="select last_insert_id()")
	public int insertPark(Park park);
	
	@Update("update park set status = #{status} where id = #{id}")
	public int updateParkStatus(int id);
	
	@Delete("delete from park where id = #{id}")
	public int deletePark(int id);
	
	@Update("update park set name=#{name},price=#{price} where id = #{id}")
	public int updatePark(Park park);
}
